package 进制转换.K进制表示下的各位数字总和;

public class kjzbsxdgwszzh {
    public static void main(String[] args) {
        System.out.println("=="+sumBase(34,6));
    }
    public static int sumBase(int n, int k) {
        int result = 0;
        while (n > 0){
            result += n % k;
            n /= k;
        }
        return result;
    }
}
